package com.sdgroup.service.impl;

import com.sdgroup.entity.MemberEntity;
import com.sdgroup.service.PageIndexService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: 实现类
 * @author: 李文
 * @create: 2021-03-07 10:29
 **/
@Log4j2
@Service
public class PageIndexServiceImpl implements PageIndexService {
    @Override
    public List<MemberEntity> selectAll() {
        ArrayList<MemberEntity> list = new ArrayList<>();
        MemberEntity memberEntity = new MemberEntity();
        memberEntity.setNickName("7d性能测试一号");
        memberEntity.setCity("北京");
        list.add(memberEntity);
        return list;
    }

    @Override
    public List<MemberEntity> selectSleepAll() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        ArrayList<MemberEntity> list = new ArrayList<>();

        log.info("开始" + System.currentTimeMillis());
        MemberEntity memberEntity = new MemberEntity();
        memberEntity.setNickName("现在的线程是：" + Thread.currentThread().getName());
        list.add(memberEntity);

        return list;
    }
}

